POV-Ray : Newsgroups : povray.general : Projective transform matrix : Re: Projective transform matrix Server Time
31 Jul 2024 12:26:59 EDT (-0400)
  Re: Projective transform matrix  
From: Warp
Date: 19 Feb 2007 03:33:20
Message: <45d960d0@news.povray.org>
John VanSickle <evi### [at] hotmailcom> wrote:
> The main problem with using a non-linear transform in POV-Ray is that a 
> non-linear transform can have more than one inverse, or possibly no 
> inverse, and POV-Ray requires its transforms to have exactly one 
> inverse.  (This is also the reason that a scaling value of zero results 
> in an error; such matrices have no inverse.)

  All POV-Ray users are used to thinking that when the specify a
transformation (such as rotate, scale and translate) they are actually
transforming the object itself. In other words, it's the object itself
which moves and changes orientation and shape.

  In fact, that's actually true for a limited number of cases. For example,
if you translate a sphere, what POV-Ray does is to simply move the center
of the sphere and that's it. In this case the transformation was really
a modification of the object. However, this was just a special case done
for efficiency because it's easy to do.

  However, other transformations are not so easy to apply directly to the
object. For instance, suppose you apply "scale <1, 0.25, 1> rotate z*35"
to the sphere. Suddenly the sphere was converted into an ellipsoid and,
what's worse, its axes are not parallel to the main axes anymore. The
equation of such an ellipsoid suddenly became a whole lot more complicated
than that the one of a sphere.
  Now skew this ellipsoid by further applying an additional
"scale <1, 0.5, 1>" and suddenly you have an irregular shape which
formula is even more complicated.

  With a sphere it might even be theoretically possible to apply all
these transformations directly to it, using different formulas for
different possible shapes. However, think about more complex surfaces
such as torii, superellipsoids or 4D julia fractals. It quickly becomes
prohibitively hard.

  It becomes clear that applying the transformation to the object itself
is not possible in the general case. So how does POV-Ray do it?

  Well, the clever trick is that instead of modifying the object, what
is modified is the *ray* which tests the intersection against that object.
More specifically, instead of applying the transformation to the object,
the inverse transformation is applied to the ray instead. This allows
very easily and in a general way to apply any such transformation to
any object which is raytraceable.

  Of course there's a catch: The inverse transformation must exist, and
it must be linear. The ray must remain straight after the transformation.
Raytracing with curved rays is prohitively difficult and slow.

  That's the reason why non-linear transformations are so difficult.
They would require raytracing with curved lines, which would be slow
and error-prone.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.